﻿#region

using System.ComponentModel;
using System.Net.Mail;
using System.Web.Services;
using MailQ.API;

#endregion

namespace MailQ.WebService
{
	/// <summary>
	/// 	Summary description for MailQWeb
	/// </summary>
	[WebService(Namespace = "http://tempuri.org/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	[ToolboxItem(false)]
	public class MailQWeb : System.Web.Services.WebService
	{
		/// <summary>
		/// </summary>
		/// <param name = "Msg"></param>
		[WebMethod]
		public void AddMailToQ(MailMessage Msg)
		{
			MailQException Ex = new MailQException();
			EmailHelper.AddEmailToQueue(Msg, ref Ex);
		}

		[WebMethod]
		public void AddEmailToQ(string From, string To, string Cc, string Bcc, string Subject, string Body, bool IsBodyHtml)
		{
			MailQException Ex = new MailQException();
			EmailHelper.AddEmailToQueue(From, To, Cc, Bcc, Subject, Body, IsBodyHtml, ref Ex);
		}

		/// <summary>
		/// </summary>
		/// <param name = "From"></param>
		/// <param name = "To"></param>
		/// <param name = "Cc"></param>
		/// <param name = "Bcc"></param>
		/// <param name = "Subject"></param>
		/// <param name = "Body"></param>
		/// <param name = "IsBodyHtml"></param>
		[WebMethod]
		public void AddEmailToQ(string From, string[] To, string[] Cc, string[] Bcc, string Subject, string Body, bool IsBodyHtml)
		{
			MailQException Ex = new MailQException();
			EmailHelper.AddEmailToQueue(From, To, Cc, Bcc, Subject, Body, IsBodyHtml, ref Ex);
		}

		/// <summary>
		/// </summary>
		/// <param name = "From"></param>
		/// <param name = "To"></param>
		/// <param name = "Cc"></param>
		/// <param name = "Bcc"></param>
		/// <param name = "Subject"></param>
		/// <param name = "Body"></param>
		/// <param name = "IsBodyHtml"></param>
		[WebMethod]
		public void AddEmailToQ(MailAddress From, MailAddressCollection To, MailAddressCollection Cc, MailAddressCollection Bcc, string Subject, string Body, bool IsBodyHtml)
		{
			MailQException Ex = new MailQException();
			EmailHelper.AddEmailToQueue(From, To, Cc, Bcc, Subject, Body, IsBodyHtml, ref Ex);
		}

		public EmailStatus GetMessageStatus(int MessageId)
		{
			return EmailHelper.GetEmailStatus(MessageId);
		}
	}
}